//
//  XinLiCePingOptionsTCell.m
//  students
//
//  Created by 任辰东 on 2024/3/4.
//

#import "XinLiCePingOptionsTCell.h"

@interface XinLiCePingOptionsTCell ()

@property (nonatomic, strong) UIImageView *iconImageView;
@property (nonatomic, strong) UILabel *contentLabel;
@end

@implementation XinLiCePingOptionsTCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)configCellWithModel:(XinLiCePingOptionsModel *)model
{

    self.contentLabel.text = [NSString stringWithFormat:@"%@%@",model.options_name,model.options_title];
    
    if (model.is_answer) {
        self.iconImageView.image = UIImageWithName(@"xinliceping_selected");
    } else {
        self.iconImageView.image = UIImageWithName(@"xinliceping_select");
    }
    
}

-(void)setupViews
{
    [self.contentView addSubview:self.iconImageView];
    [self.contentView addSubview:self.contentLabel];
}

-(void)setupLayout
{
    [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
          
        make.left.equalTo(self.contentView).offset(15);
        make.centerY.equalTo(self.contentView);
        make.height.width.mas_equalTo(15);
    }];
    
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.equalTo(self.iconImageView.mas_right).offset(5);
        make.right.equalTo(self.contentView).offset(-15);
        make.top.bottom.equalTo(self.contentView);
        make.height.mas_equalTo(30);
    }];
}

-(UIImageView *)iconImageView
{
    if (!_iconImageView) {
        _iconImageView = [UIImageView new];
        _iconImageView.contentMode = UIViewContentModeScaleAspectFill;
        _iconImageView.clipsToBounds = YES;
    }
    return _iconImageView;
}

-(UILabel *)contentLabel
{
    if (!_contentLabel) {
        _contentLabel = [UILabel new];
        _contentLabel.text = @"时间";
        _contentLabel.textColor = UIColorFromHex(0x000000);
//        _contentLabel.numberOfLines = 0;
        _contentLabel.font = UIFontSize(16);
        _contentLabel.adjustsFontSizeToFitWidth = YES;
    }
    return _contentLabel;
}

@end
